package com.bbcare.followup.plat.controller;

import com.bbcare.comm.ResultModel;
import com.bbcare.followup.plat.dto.request.PtUserSharePhotoAddReqDTO;
import com.bbcare.followup.plat.dto.request.PtUserSharePhotoQueryReqDTO;
import com.bbcare.followup.plat.service.IPtUserSharePhotoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;


/**
 * 医生分享用户照片 控制器
 *
 * @author liqianlong
 * @since 2021-04-27
 */
@RestController
@RequestMapping("/ptUserSharePhoto")
public class PtUserSharePhotoController {

    @Autowired
    private IPtUserSharePhotoService ptUserSharePhotoService;

    /**
     * 全部医生分享照片分页查询
     * @param reqDTO 请求参数
     * @return
     */
    @PostMapping("/listPage")
    public ResultModel listPage(@RequestBody PtUserSharePhotoQueryReqDTO reqDTO, HttpServletRequest request) {
        Map<String,Object> map = ptUserSharePhotoService.listPage(reqDTO,request);
        return new ResultModel(map);
    }

    /**
     * 医生新增分享照片
     * @param reqDTO 请求参数
     * @return
     */
    @PostMapping("/add")
    public ResultModel add(@RequestBody PtUserSharePhotoAddReqDTO reqDTO, HttpServletRequest request) throws Exception {
        String id = ptUserSharePhotoService.add(reqDTO,request);
        return new ResultModel(id);
    }

    /**
     * 用户相关照片分页（按天合并）
     * @param reqDTO 请求参数
     * @return
     */
    @PostMapping("/historyPage")
    public ResultModel historyPage(@RequestBody PtUserSharePhotoQueryReqDTO reqDTO, HttpServletRequest request) {
        Map<String,Object> map = ptUserSharePhotoService.historyPage(reqDTO,request);
        return new ResultModel(map);
    }
}
